﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace SmoLiteApi
{
    /// <summary/>
    public class IndexCollection : IEnumerable<Index>
    {
        private List<Index> _indexs;

        /// <summary/>
        internal IndexCollection()
        {
            this._indexs = new List<Index>();
        }

        /// <summary/>
        public void Add(Index index)
        {
            this._indexs.Add(index);
        }

        /// <summary/>
        public Index this[string name]
        {
            get { return this._indexs.Find(value => value.Name == name); }
        }

        /// <summary/>
        public IEnumerator<Index> GetEnumerator()
        {
            return this._indexs.GetEnumerator();
        }

        /// <summary/>
        IEnumerator IEnumerable.GetEnumerator()
        {
            return this._indexs.GetEnumerator();
        }

        /// <summary/>
        public int Count
        {
            get { return this._indexs.Count; }
        }

        /// <summary/>
        public Index this[int index]
        {
            get { return this._indexs[index]; }
        }
    }
}
